package com.sky.mapper;

import com.sky.annotation.AutoFill;
import com.sky.entity.Setmeal;
import com.sky.entity.SetmealDish;
import com.sky.enumeration.OperationType;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {
    /*
    * 根据菜品id查询对应的套餐id
    * */
    List<Long> getSetmealIdsByDishIds(List<Long> dishIds);

    /*
    * 更新套餐信息
    * */
    @AutoFill(value = OperationType.UPDATE)
    void update(Setmeal setmeal);


    /*
    * 增加套餐信息
    * */
    void insertBatch(List<SetmealDish> setmealDishes);

    /*
     * 根据id查询套餐详细信息
     * */
    @Select("select * from setmeal_dish where setmeal_id = #{id}")
    List<SetmealDish> getByIdBatch(Long id);


    /*
    * 根据套餐id删除套餐信息
    * */
    @Delete("delete from setmeal_dish where setmeal_id = #{setmealId}")
    void delete(Long setmealId);

    /*
     * 批量删除套餐详细信息
     * */
    void deleteBatch(List<Long> ids);
}
